<template>
  <div class="CommentList">
    <div class="CommentList_title">
      全部评论
      <span>
        {{ list.length }}
      </span>
    </div>

    <div class="CommentList_container">
      <div
        v-for="(item, i) in list"
        :key="i"
        :class="{
          CommentList_item_line: i !== list.length - 1,
          CommentList_item: 1
        }"
      >
        <el-avatar class="user-avatar" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />

        <div class="CommentList_content">
          <div class="CommentList_user_info">
            <div class="user_name">
              {{ item.trueName || '未知用户' }}
            </div>

            <div class="user_edit_time">
              {{ item.editTime }}
            </div>
          </div>

          <div class="CommentList_talk">
            <div class="talk_content">
              {{
                item.content
              }}
            </div>

            <div class="talk_img">
              <el-image
                v-for="pic in item.photolist"
                :key="pic.id"
                class="img_item"
                fit="cover"
                :preview-src-list="[pic.img]"
                :src="pic.img"
              />
            </div>
          </div>
        </div>

        <!-- <a-comment>
          <a slot="author">{{ item.trueName || '未知用户' }}</a>
          <a-avatar
            slot="avatar"
            src="https://img1.baidu.com/it/u=1136864548,1606862484&fm=26&fmt=auto&gp=0.jpg"
            :alt="item.trueName || '未知用户'"
            :size="50"
          />
          <div slot="content" class="comment_container">
            <div class="comment_comment">
              {{
                item.content
              }}
            </div>

            <div class="comment_photo">
              <el-image
                v-for="pic in item.photolist"
                :key="pic.id"
                class="showimg"
                mode="none"
                :preview-src-list="[pic.img]"
                :src="pic.img"
              />
            </div>

          </div>
          <a-tooltip slot="datetime">
            <div class="comment_timer">{{ item.editTime }}</div>
          </a-tooltip>
        </a-comment> -->
      </div>
    </div>

  </div>
</template>

<script>
import moment from 'moment';

export default {
  name: 'CommentList',

  props: {
    list: {
      type: Array,
      default: () => []
    }
  },

  data() {
    return {
      likes: 0,
      dislikes: 0,
      action: null,
      moment
    };
  },

  methods: {
  }
};
</script>

<style lang="scss" scoped>
.CommentList {
  .CommentList_title {
    font-size: 22px;

    > span {
      color: #AAAAAA;
    }
  }

  .CommentList_container {
    // background-color: red;
    margin-top: 20px;
    .comment_comment {
      margin-top: 20px;
    }

    .CommentList_item {
      display: flex;
      margin-bottom: 30px;
      .user-avatar {
        margin-right: 10px;
      }

      .CommentList_content {
        flex: 1;
        margin-right: 10px;
        .CommentList_user_info {
          justify-content: space-between;
          display: flex;
          .user_name {
            color: #303133;
            font-size: 16px;
            font-weight: 500;
          }

          .user_edit_time {
            color: #999999;
            font-size: 14px;
          }
        }

        .CommentList_talk {
          margin-top: 20px;
          .talk_content {
            color: #666666;
          }

          .talk_img {
            $imgH: 100px;
            margin-top: 20px;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax($imgH, 1fr));
            gap: 20px;
            .img_item {
              height: $imgH;
              border-radius: 4px;

            }
          }
        }

      }
    }
  }

}
    .CommentList_item_line {
      position: relative;
      &::after {
        content: '';
        display: block;
        height: 1px;
        position: absolute;
        right: 10px;
        left: 10px;
        z-index: 9;
        bottom: -10px;
        background-color: #E2E2E2;
      }
    }

/deep/ .ant-avatar {
  img {
    width: 45px;
    height: 45px;
  }
}
</style>
